<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.global.js"></script>
</head>
<body>
    <div id="app"></div>
</body>
<script>
    var {createApp} = Vue;
    var {ref,reactive} = Vue;
    var {unref,toRaw,markRaw,isRef,isReactive} = Vue;
    var {onBeforeMount,onMounted} = Vue;

    // onBeforeMount
    // 注册一个钩子，在组件被挂载之前被调用。  => 传入一个函数(回调函数),等组件挂载之前执行



    var app = createApp({
        setup(){

            let a = ref(10);
            let zhang =  reactive({name:"张三",age:18});


            onBeforeMount(()=>{
                console.log("组合式","beforeMount1");
            })
            onBeforeMount(()=>{
                console.log("组合式","beforeMount2");
            })
            onBeforeMount(()=>{
                console.log("组合式","beforeMount3");
            })

            onMounted(()=>{
                console.log("组合式","onMounted");
            })


            return {
                a,
                zhang
            }
        },
        beforeMount() {
            console.log("选项式","beforeMount1");
        },
        mounted() {
            console.log("选项式","mounted");
        },
    })

    app.mount("#app");

</script>
</html>